import typescript from '@rollup/plugin-typescript';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';

export default {
  input: 'src/index.ts', // 入口文件
  output: [
    {
      file: 'dist/index.cjs', // CommonJS 输出
      format: 'cjs',
      exports: 'auto'
    },
    {
      file: 'dist/index.esm.js', // ESM 输出
      format: 'esm'
    }
  ],
  plugins: [
    resolve(), // 解析 Node.js 模块
    commonjs(), // 转换 CommonJS 模块为 ESM
    typescript() // 编译 TypeScript
  ]
};